// Badge

@import '../../style/themes/default';
@import '../../style/mixins/index';
@import './param';

@mixin badge {
  font-size: $--x-font-size;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-align: center;
  position: relative;
  > sup {
    position: absolute;
    top: 0;
    right: 0.625rem;
    transform: translateY(-50%) translateX(100%);
    border-radius: 0.625rem;
    color: $--x-white;
    display: inline-block;
    height: 1.125rem;
    line-height: 1.125rem;
    padding: 0 0.375rem;
    text-align: center;
    white-space: nowrap;
    border: 0.0625rem solid $--x-border;
  }
  &-dot {
    > sup {
      width: 0.5rem;
      height: 0.5rem;
      padding: 0;
      right: 0.3125rem;
      border-radius: 50%;
    }
  }
  @include badge-type('primary', $--x-primary);
  @include badge-type('success', $--x-success);
  @include badge-type('info', $--x-info);
  @include badge-type('warning', $--x-warning);
  @include badge-type('danger', $--x-danger);
  @include badge-type('text', $--x-text);
}

@mixin badge-type($type, $color) {
  &-#{$type} {
    > sup {
      background-color: $color;
    }
  }
}
